<template>
  <div>
    <div class="hot-salon" v-for="item in salonList">
      <figure>
        <div class="salon-img">
          <img :src="item.imgsrc"/>
        </div>
        <figcaption>
          <div class="salon-title">{{item.title}}</div>
          <div class="salon-text">{{item.text}}</div>
          <div class="salon-icons">
            <like-icon :number="item.likeNumber"></like-icon>
            <router-link to="/common/ecFriend?title=英语角" v-if="isLogin">
              <chat-icon></chat-icon>
            </router-link>
          </div>

        </figcaption>

      </figure>
    </div>
  </div>

</template>
<script>
  import chatIcon from './chaticon'
  import likeIcon from './likeit'
    export default{
      data:function(){
          return {
            salonList:{},
            category:'英语沙龙',
            name:''
          }
      },
      props:["isLogin"],
      components:{
        'like-icon':likeIcon,
        'chat-icon':chatIcon
      },
      created:function(){
        this.getData();
      },
      watch:{
        '$route':"getData"
        // 对路由变化作出响应...
      },
      methods:{
        getData:function(){
          this.category=this.$route.query.category;
          this.$http.get("static/salon.json").then(function(response){
            if(this.category=="英语沙龙"){
              this.salonList=response.data.salonData;
            }else if(this.category=="脑洞大开"){
              this.salonList=response.data.wisdomData;
            }else{
              this.salonList=response.data.workData;
            }
          },function(response){
            console.log(response);
          });
        }
      }
    }
</script>
<style scoped>
  .hot-salon{
    width: 86%;
    margin:25px auto;
    border-radius: 20px;
    background-color: #fff;
    box-shadow: 0 10px 24px rgba(152,143,143,0.5);
    padding: 0;
    overflow: hidden;
  }
  .hot-salon figure{
    width: 100%;
    height: 100%;
    margin: 0;
  }
  .hot-salon figure .salon-img{
    height: 160px;
    width: 100%;
    overflow: hidden;
  }
  .hot-salon figure .salon-img img{
    display: inline-block;
    /*margin-top: -150px;*/
    width: 100%;
  }
  .hot-salon figcaption{
    padding: 3% 4%;
    text-align: left;
    height: 97px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
  }
  .hot-salon figcaption div.salon-title{
    color: #090909;
    font-weight: bold;
    font-size: 16px;
  }
  .hot-salon figcaption div.salon-text{
    color: #A1A1A1;
    font-size:13px;
  }
  .hot-salon figcaption .salon-icons div{
    margin: 0 2%;
  }
  .hot-salon figcaption .salon-icons div:nth-of-type(1){
    margin-left: 0;
  }
  @media (max-width: 320px){
    .hot-salon figcaption div.salon-title{
      font-size: 15px;
    }
    .hot-salon figcaption div.salon-text{
      font-size:13px;
    }
  }
</style>
